const fs = require('fs');
const path = require('path');
const morgan = require('morgan');
const formatDate = require('./formatDate')
let date = formatDate.getFormatDate();
//output file
var accessLogStream = fs.createWriteStream(path.join(__dirname, '../../log/http',date+'.log'), {flags: 'a'});
var logger = morgan('common', {stream: accessLogStream});

//format：
// morgan.token('from', function(req, res){
//     return req.query.from || '-';
// });

// morgan.format('joke', '[joke] :method :url :status :from');

// app.use(morgan('joke'));

module.exports = logger;
